import time
import json
from datetime import datetime, timedelta
from django.conf import settings
from rest_framework import viewsets
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.reverse import reverse_lazy

# from .FilterSets import *
from iClouds.mktoken import get_tokens_for_user
from iClouds.Authentication import *
from iClouds.Permissions import *
from iClouds.FilterSets import *
# from iClouds.PulsarSDK import *
from iClouds.apidev import filter_views

from .weChatSDK import *

# from .redis import *
# from .pulsers import *

import random, string
import hashlib
from urllib.parse import urlparse
from itertools import product


def has_PassWord(len=6):
    """返回随机密码"""
    # work = string.ascii_lowercase + string.ascii_uppercase + string.digits + string.punctuation
    work = string.ascii_letters + string.digits
    chosen = random.sample(work, len)
    return "".join(chosen)


def hash_md5(x):
    """MD5加密"""
    return hashlib.md5(x.encode("utf-8")).hexdigest()
